package com.journaldev.spring.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="phong_kham")
public class PersonalOffice {
	
	public PersonalOffice(int id, String addressOffice, String taxCode,
			String officeName) {
		super();
		this.id = id;
		this.addressOffice = addressOffice;
		this.taxCode = taxCode;
		this.officeName = officeName;
	}

	public PersonalOffice() {
		
		
	}
	
	@Id
	@Column(name="id_phongkham")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int id;

	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	@Column(name="address")
	private String addressOffice;

	public String getAddressOffice() {
		return addressOffice;
	}

	public void setAddressOffice(String addressOffice) {
		this.addressOffice = addressOffice;
	}

	@Column(name="tax_code")
	private String taxCode;

	public String getTaxCode() {
		return taxCode;
	}

	public void setTaxCode(String taxCode) {
		this.taxCode = taxCode;
	}
	
	@Column(name="ten_phong_kham")
	private String officeName;

	public String getOfficeName() {
		return officeName;
	}

	public void setOfficeName(String officeName) {
		this.officeName = officeName;
	}
	
	@OneToOne(fetch = FetchType.EAGER , mappedBy = "ownOffice")
	// Remember to add mappedBy on the @OneToOne annotation to ensure that only one side manages the relationship. 
	@JoinColumn(name = "id_phongkham")
	private UserInfo userInfo;

	public UserInfo getUserInfo() {
		return userInfo;
	}

	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}
	
}
